<?php
$sch = new \Swoole\Coroutine\Scheduler;
$chan = new \Swoole\Coroutine\Channel(1);
$sch->add(function () use ($sch,$chan) {
    $chan->push(json_encode(["username"=>"jake"]));
    $chan->push(json_encode(["age"=>"11"]));
    var_dump($chan->stats());
    var_dump($chan->close());
    var_dump($chan->length());
    var_dump($chan->isEmpty());
    var_dump($chan->isFull());
});
$sch->add(function () use ($sch,$chan) {
   echo "consume===1===".$chan->pop().PHP_EOL;
   var_dump($chan->stats());
   var_dump($chan->close());
   var_dump($chan->length());
   var_dump($chan->isEmpty());
   var_dump($chan->isFull());
});

$sch->add(function () use ($sch,$chan) {
    echo "consume===2===".$chan->pop().PHP_EOL;
    var_dump($chan->stats());
    var_dump($chan->close());
    var_dump($chan->length());
    var_dump($chan->isEmpty());
    var_dump($chan->isFull());
});
$sch->start();